﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
using ProDivingAdmin2salmon14;

namespace Test_ProDivingAdmin2salmon14
{
    [TestFixture]
    class TestDive
    {
        [Test]
        public void TestCalculateScore()
        {
            
            Contest c = new Contest(true, 18, 1,7);
            Dive d = new Dive("104A1");
            d.CalculateScore();
            Assert.AreEqual(0f, d.diveScore);
            
            for (int i = 0; i < 7; i++)
            {
                d.judgeScores.Add(new Tuple<string, float>("SWE", 8.5f));
            }

            d.CalculateScore();
            Assert.AreEqual(110.5,0.05f, d.diveScore);
            Assert.AreNotEqual(d.diveScore, 100f);
        }

        [Test]
        public void TestProperties()
        {
            Dive d = new Dive();

            d.diveCode = "101B1";
            d.diveScore = 45;
            for (int i = 0; i < 5; i++)
            {
                d.judgeScores.Add(new Tuple<string, float>("SWE", 8.5f));
            }

            Assert.AreEqual(d.diveCode, "101B1");
            Assert.AreEqual(d.diveScore, 45f);
        }

        [Test]
        public void TestGetDifficulty()
        {

            Contest tempContest = new Contest(true, 18, 3,7);
            Dive dive = new Dive("101A3");
            Assert.AreEqual(dive.GetDifficulty(), 1.6f);
        }

        [Test]
        public void TestGetName()
        {
            Contest tempContest = new Contest(true, 18, 3,7);
            Dive dive = new Dive("101A3");
            Assert.AreEqual(dive.GetName(), "Forward Dive");
        }
    }
}
